package com.jd.jobkeeper.server.service;

import com.jd.jobkeeper.protocals.Task;
import com.jd.jobkeeper.server.data.entity.JobInfo;
import com.jd.jobkeeper.server.data.entity.TaskInfo;
import org.springframework.data.domain.Page;

import java.util.List;

public interface TaskService {

    List<TaskInfo> findByJobIdAndStatus(Long jobId, Integer... statuses);

    Task findByJobId(Long jobId);

    TaskInfo getLastTask(JobInfo jobInfo);

    TaskInfo produceTask(TaskInfo lastTask, JobInfo jobInfo);

    void updateTask(Task task);

    boolean testAndSet(Task task);

    Page<TaskInfo> page(String namespace,int page,int size);


}
